#include "CWinTest.h"

LRESULT CWinTest::OnDestroyHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    PostQuitMessage(0);
    return TRUE;
}

LRESULT CWinTest::OnPaintHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    PAINTSTRUCT Ps = { 0 };
    PCWCH lpString = _T("HelloWOrld");
    HDC hDC = BeginPaint(&Ps);
    TextOut(hDC, 0, 0, lpString, wcslen(lpString));
    EndPaint(&Ps);
    return TRUE;
}

LRESULT CWinTest::OnCreateHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    RECT rc = { 0,50,100,70 };
    m_Edit.Create(_T("Edit"), this, 2, m_hWnd, rc, nullptr, WS_CHILD | WS_VISIBLE | WS_BORDER);
    CenterWindow();
    return TRUE;
}

LRESULT CWinTest::OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    bHandled = FALSE;
    if (wParam == _T('a'))
        bHandled = TRUE;
    return TRUE;
}

LRESULT CWinTest::OnChar2(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    bHandled = FALSE;
    if (wParam == _T('t'))
        bHandled = TRUE;
    return TRUE;
}
